import { useMenuStore } from '@/stores/modules/menu'

/**
 * @description 页面按钮权限
 * */
export const useAuthButtons = () => {
  const route = useRoute()
  const menuStore = useMenuStore()
  const authButtons = menuStore.btnMap.get(route.path) || []

  const BUTTONS = computed(() => {
    let currentPageAuthButton: { [key: string]: boolean } = {}
    authButtons.forEach((item) => (currentPageAuthButton[item] = true))
    return currentPageAuthButton
  })

  return {
    BUTTONS
  }
}
